package com.bjsxt.lambda2;

public interface MyInterface2 {
    public void method(int num);

    public static void main(String[] args) {
        //情况1：
        MyInterface2 myInterface = (int num )->{
            System.out.println(num+100);
        };
        myInterface.method(100);

        //情况2：参数的类型可以省略，参数名任意；如果方法体只有一条语句，{}可以省略
        MyInterface2 myInterface2 = (n)->System.out.println(n+200);
        myInterface2.method(200);

        //情况3：如果只有一个参数，()可以省略
        MyInterface2 myInterface3 = n->System.out.println(n+200);
        myInterface3.method(200);
        //情况4：如果方法体多条语句,{}不可以省略
        int m = 5;
        MyInterface2 myInterface4 = n->{
            System.out.println(n+200);
            System.out.println(m);
            System.out.println("=============");

        };
        myInterface4.method(200);


    }
}
